package com.example.zsf.view;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;


import com.example.zsf.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ProgressiveDialog extends Dialog {

    @BindView(R.id.tv_content)
    TextView tvContent;

    private View rootView;
    private String contentString;

    public ProgressiveDialog(Context context) {
        super(context, R.style.ProgressiveDialog);
        setCanceledOnTouchOutside(false);
        this.setCancelable(true);
        rootView = LayoutInflater.from(context).inflate(R.layout.progress_view, null);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(rootView);
        ButterKnife.bind(this, rootView);
    }

    @Override
    public void show() {
        super.show();
        if (!TextUtils.isEmpty(contentString)) {
            tvContent.setText(contentString);
        }
    }

    public void setTvContent(String string) {
        contentString = string;
    }
}
